/**
  ******************************************************************************
  * @file    w25xxx.h
  * @author  shentq
  * @version V2.2
  * @date    2019/08/14
  * @brief
  ******************************************************************************
  * @attention
  *
  * No part of this software may be used for any commercial activities by any form
  * or means, without the prior written consent of shentq. This specification is
  * preliminary and is subject to change at any time without notice. shentq assumes
  * no responsibility for any errors contained herein.
  * <h2><center>&copy; Copyright 2015 shentq. All Rights Reserved.</center></h2>
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ADS7853_H
#define __ADS7853_H

#include "ebox_core.h"
#include "spi.h"



class ADS7853
{
public:
    ADS7853(Gpio *_cs, Spi *_spi)
    {
        this->cs = _cs;
        this->spi = _spi;
    }
    void begin();
    void process();
    int32_t read();
    double read_voltage()
    {
        int32_t temp;
        double voltage;
        temp = read();
        voltage = temp / 16777216.0;
    }

private:
    Spi             *spi;
    Gpio            *cs;
    Spi::Config_t   cfg;
};

#endif
